-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for C++20 modules (#174) #173
base: master
Are you sure you want to change the base?
Conversation
Has anyone had a chance to look at this MR yet? |
I merged the most recent master in case someone does want to take a look at the PR, but the build is failing. |
@alfaix please rebase, to trigger the updated CI checks. |
2f3d62d
to
d3ae64b
Compare
Rebased, ran tests, seems to be fine. The commit history is a little bit messy, but assuming you'll squash shouldn't matter. |
This increases state count too much, I believe this can be refactored and improved |
I don't know much about tree sitter so I don't really understand what increased the state count. Is it the If it's the export thing then I guess it can be changed to a single |
Working Draft (Generated on 2024-04-22 from the LaTeX sources by cxxdraft-htmlgen. This is not an ISO publication. Note: this is an early draft. It's known to be incomplet and incorrekt, and it has lots of bad formatting. Contents |
Whats the current status on this? |
@Tomcat-42 I just use my branch in my neovim and it works. When I have the time, I can go back to this and work on reducing the state count, but for now have other priorities. If you have the time and the energy - feel free to take over :) |
@Tomcat-42 sure, will do |
This PR adds support for C++20 modules.
(Semi-)formal syntax description can be found on cppreference.
While implementing support for modules, I also noticed that class template instantiation, as well as explicit function (or class) templates instantiation declarations (i.e.,
extern (template_instatiation)
) were not parsed correctly. I fixed that in the second commit of three. Please let me know if it would be preferrable to split this in two PRs.I'm not a tree-sitter expert, I just want to experiment with C++20 modules in my neovim.
Thus, the new rules may have a couple issues. The ones that stick out to me are:
optional($.export_declaration)
needed to be added to (almost) every top-level declaration. Not sure if there is a more elegant way of doing it, as many of them are not grouped together and introducing such a group now would break old queries. I wanted to keep theexport
specifier as part of the declaration, so introducing a newexport
statement felt like a worse solution.Summary:
template_instantiation
to match class instantiation, as well as instantiation declarationsexport
keyword as an optional part of all exportable declarations and definitionsResolves: #174